﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Core.Common;
using SonCa.SocialNetwork.Web.ASCX.IPresenters;
using System.ComponentModel.Composition;
using Core.BusinessLogic.Interfaces;

namespace SonCa.SocialNetwork.Web.ASCX.Presenters
{
    public class ChangePasswordPresenter
    {
        private IChangePassword _view;
        [Import]
        private IAccountService _accountService;

        public ChangePasswordPresenter()
        {
            MEFManager.Compose(this);
        }

        public bool UpdatePassword(string accountID, string password)
        {
            int id = Convert.ToInt32(accountID);
            password = password.Encrypt(password);
            return _accountService.UpdatePassword(id, password);
        }
    }
}